using System;
using GameServer.ShootingGame.RenderableClasses;
using System.Collections.Generic;
namespace GameServer.Common.DataStructures2
{
    public class Array2D<T>
    {
        private int columns;
        private int rows;
        private List<T> list;

        public Array2D(int columns, int rows)
        {
            this.columns = columns;
            this.rows = rows;
            list = new List<T>(rows * columns);
        }

        public T GetElement(int column, int row)
        {
            return list[row * columns + column];
        }

        public void Rezize(int numColumns, int numRows)
        {
            this.columns = numColumns;
            this.rows = numRows;
            list.Capacity = numRows * numColumns;
        }

        public void Add(T item)
        {
            list.Add(item);   
        }

        public void AddRange(T[] array)
        {
            foreach (T value in array)
            {
                list.Add(value);
            }
        }
    }
}
